<template>
  <view>  <image style="width: 100%;" mode="widthFix" src="https://p0.ssl.img.360kuai.com/t0119f8f3b09ddf7e73.png" /></view>
  <view class="all-data">
    <view class="income-data">
      <view class="data-title"> 
         <view>今日数据</view>
         <view>昨日数据</view>
      </view>

      <view class="data-info">
          <view class="body" v-for="item in dataInfos" :key="item.text"> 
              <view class="tip">
                {{item.data}}
              </view>
              <view>
                {{item.text}}
              </view>
          </view>
      </view>

    </view>
  </view>
</template>

<script setup lang="ts">

import dyUserPlayingService from "@/api/dyUserPlayingService";

const dataInfos =ref()

const getUserInComeCache = async()=>{
 const {result,success} = await dyUserPlayingService.getUserInComeCache()
 if(success){
  console.log(result)
  dataInfos.value =  [
{
  data:result.toAdd ?? 0,
  text:'访问人数'
},
{
  data:result.orderIncome ?? 0,
  text:'订单次数'
},

{
  data:result.toYeAdd ?? 0,
  text:'访问人数'
},

{
  data:result.orderYeIncome ?? 0,
  text:'订单次数'
},

{
  data:0,
  text:'预估eCPM'
},

{
  data:result.toIncome / 100 ?? 0,
  text:'预估金额'
},

{
  data:"更新中",
  text:'实际eCPM'
},
{
  data:result.toYeIncome / 100 ?? 0,
  text:'实际金额'
}


]
  

 }
}

onMounted(()=>{
  getUserInComeCache()
})



</script>

<style lang="scss" scoped>
.all-data{
  padding: 20rpx;
  background: rgb(248,247,252);
  font-size: 20rpx;
  margin-top: -10rpx;
  .income-data{
    .data-title{
      padding: 5rpx 20%;
      display: flex;
      justify-content: space-between;
    }
    .data-info {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap; 
    }

    .data-info .body {
        margin: 20rpx 35rpx;
        flex-grow: 1;
        text-align: center;
        .tip{
          margin-bottom: 10rpx;
          font-size: 25rpx;
        }
    }
  }
}
</style>
